<?php

namespace app\models\search;

use app\models\CtiJnz;
use yii\base\Model;
use yii\data\ActiveDataProvider;

class CtiJnzSearch extends CtiJnz
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'skill_level', 'create_at', 'create_at'], 'integer'],
            [['name','en','level','fpfs','in_out','timezone1','timezone2','remark'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        return Model::scenarios();
    }

    public function search($params)
    {
        $query = CtiJnz::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            'id' => $this->id,
            'skill_level' => $this->skill_level,
            'create_at' => $this->create_at,
            'create_at' => $this->create_at,
        ]);
        $query->andFilterWhere(['like', 'name', $this->name])
            ->andFilterWhere(['like', 'en', $this->en])
            ->andFilterWhere(['like', 'level', $this->level])
            ->andFilterWhere(['like', 'fpfs', $this->fpfs])
            ->andFilterWhere(['like', 'in_out', $this->in_out])
            ->andFilterWhere(['like', 'timezone1', $this->timezone1])
            ->andFilterWhere(['like', 'timezone2', $this->timezone2])
            ->andFilterWhere(['like', 'remark', $this->remark]);
        return $dataProvider;
    }
}
